/*
 *
 * Copyright (c) 2021
 * User:Dybala
 * File:testRedis.java
 * Date:2021/11/09 20:57:09
 */

package com.example.pubinfo;

import com.service.redisService;


import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * redis测试类
 * 已完成测试
 */
@ExtendWith(SpringExtension.class)
@SpringBootTest
public class testRedis {
    public static final long EXPIRE_TIME = 10 * 1000;//10秒

    @Autowired
    redisService service;

    @Test
    public void testSet(){
        System.out.println(service);
        service.set("tttdd2123123sf","555");
        System.out.println(service.get("305553138"));
    }
    @Test
    public void testSet2(){
        System.out.println(service);
//        service.set("ttt","555");
        System.out.println(service.get("ttt"));
    }
    @Test
    public void testDel(){
        System.out.println(service);
//        service.set("ttt","555");
        service.del("ttt");

    }
    @Test
    public void testexpire(){
        System.out.println(service);
        service.set("ttt","555");
//        service.del("ttt");
        service.expire("ttt",EXPIRE_TIME);
    }
    @Test
    public void testGet(){
        String s = service.get("sys:user:tokeneyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJJRCI6IjEyMyIsImV4cCI6MTYzNjU1NDE5NH0.lUBcZpOfmFMrZzVWAAjXACCHheR6C5Shooa_b7Q9Qd0");
        System.out.println(s);
    }

}
